package com.expection;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

// 异常的处理方式二：声明异常（throws子句）
public class Test02 {
    public static void main(String[] args) throws IOException {
        FileReader reader = null;
        try{
            reader = new FileReader("d:/a2.txt");
            char c = (char)reader.read();
            char c2 = (char)reader.read();
            char c3 = (char)reader.read();

            System.out.println(""+c+c2+c3);
        }finally{
            // 关闭资源
            System.out.println("Test01.main.finally");
            try {
                if(reader!=null){
                    reader.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
